package org.afs.gescol.core.model.data;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.afs.gescol.core.model.references.Level;
import org.afs.gescol.core.model.references.Series;
import org.afs.gescol.core.model.references.Subject;
import org.hibernate.annotations.ForeignKey;
import org.scub.foundation.framework.core.model.BaseModel;

/**
 * Teacher subject assignments model.
 * @author Kobla GBENYO (kobla.gbenyo@gmail.com)
 */
@Entity
@Table(name = "data_teacher_assignment")
@AttributeOverrides({@AttributeOverride(name = "id", column = @Column(name = "teacher_assignment_id", nullable = false)),
    @AttributeOverride(name = "version", column = @Column(name = "teacher_assignment_version", nullable = false, unique = false)),
})
public class TeacherAssignment extends BaseModel {

    /** Serial Version UID. */
    private static final long serialVersionUID = -5071789394581148828L;

    @ManyToOne
    @JoinColumn(name = "teacher_id")
    @ForeignKey(name = "fk_data_teacher_assignment_data_teacher_id")
    private Teacher teacher;

    @ManyToOne
    @JoinColumn(name = "subject_id")
    @ForeignKey(name = "fk_data_teacher_assignment_ref_subject_id")
    private Subject subject;

    @ManyToOne
    @JoinColumn(name = "level_id")
    @ForeignKey(name = "fk_data_teacher_assignment_ref_level_id")
    private Level level;

    @ManyToOne
    @JoinColumn(name = "series_id")
    @ForeignKey(name = "fk_data_teacher_assignment_ref_series_id")
    private Series series;

    /**
     * Get the value of teacher.
     * @return the teacher
     */
    public Teacher getTeacher() {
        return teacher;
    }

    /**
     * Set the value of teacher.
     * @param teacher the teacher to set
     */
    public void setTeacher(Teacher teacher) {
        this.teacher = teacher;
    }

    /**
     * Get the value of subject.
     * @return the subject
     */
    public Subject getSubject() {
        return subject;
    }

    /**
     * Set the value of subject.
     * @param subject the subject to set
     */
    public void setSubject(Subject subject) {
        this.subject = subject;
    }

    /**
     * Get the value of level.
     * @return the level
     */
    public Level getLevel() {
        return level;
    }

    /**
     * Set the value of level.
     * @param level the level to set
     */
    public void setLevel(Level level) {
        this.level = level;
    }

    /**
     * Get the value of series.
     * @return the series
     */
    public Series getSeries() {
        return series;
    }

    /**
     * Set the value of series.
     * @param series the series to set
     */
    public void setSeries(Series series) {
        this.series = series;
    }

    @Override
    public boolean equals(Object other) {
        return equalsUtil(other);
    }

    @Override
    public int hashCode() {
        return super.hashCode();
    }

}
